<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import='java.util.*'%>
<%@ page import='com.globox.servlet.*'%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Globox home</title>
<script type="text/javascript">
function checkform(form){
	if(form.query.value == "" || form.query.value == '' || form.query.value == undefined){ 
		alert( "Invalid query" ); 
		form.query.focus(); 
		return false ; 
	} 
	return true;
}
</script>
</head>
<body style="background-color: lightgray;">

	<%
		Random rnd = new Random();
		int clientID = -1;
		if (session.getAttribute("MY_UNIQUE_ID") == null) {
			clientID = rnd.nextInt(IConstants.MAX_CLIENTS);
			session.setAttribute("MY_UNIQUE_ID", clientID);
		} else
			clientID = Integer.parseInt(session
					.getAttribute("MY_UNIQUE_ID").toString());
	%>

	<p style="background-color: black; color: white">
		Welcome to Globox, the gate to all cinemas! This is your
		auto-generated unique id:
		<%=clientID%>
	</p>

	<p>Start searching here</p>
	<form name="search" method="POST" action="/globox-client/search"
		onsubmit="return checkform(this);">
		<table>
			<tr>
				<td><input type="text" id="tbSearch" name="query" size="70" />
				</td>
				<td><input type="submit" value="Go" />
				</td>
			</tr>
		</table>
	</form>
</body>
</html>